#!/bin/bash

if [[ -z "$1" ]]
then
  echo "Usage: run <toolname> args..."
  echo "Example: run update --  -- [--force-load] [--force-html]"
  echo "Example: run live --  -- [--force-load] [--force-html]"
  echo "Example: run bottle"
  exit
fi

export PYTHONPATH=$PWD:$PYTHONPATH
tool=$1; shift

echo "Running $tool"

if [[ "$tool" == "bottle" ]]
then
  python -m tools.start_server $*
elif [[ "$tool" == "live" ]]
then
  python -m tools.make_pages -u $1 -p $2 -v 0.1 -o ../../pages --live $*
elif [[ "$tool" == "update" ]]
then
  python -m tools.make_pages -u $1 -p $2 -v 0.1 -o ../../pages $*
fi
